package com.jcl.recruit.timer.resume.service;

import com.jcl.recruit.searchresume.logic.SearchResumeRecordLogic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @ClassName SearchResumeTaskService
 * @Description TODO
 * @Author yyliu
 * @Date 2018/10/30 15:43
 * @Version 1.0
 **/
@Service
public class SearchResumeTaskService {

    private static final Logger logger = LoggerFactory.getLogger(SearchResumeTaskService.class);
    @Autowired
    private SearchResumeRecordLogic searchResumeRecordLogic;

    public void searchResumeFlushTask(){
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DATE,-1);
        String beforeDate = sdf.format(calendar.getTime());
        beforeDate = beforeDate + " 23:59:59";
        SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(sdfTime.parse(beforeDate,new ParsePosition(0)));

        searchResumeRecordLogic.batchUpdateCrawing(sdfTime.parse(beforeDate,new ParsePosition(0)));
    }

}
